package com.kuang.demo.controller;

import com.kuang.demo.bean.BaseRespVo;
import com.kuang.demo.bean.GoodsBean.GoodsBO.GoodsCommentDelete;
import com.kuang.demo.bean.GoodsBean.GoodsVO.GoodsCommetVO;
import com.kuang.demo.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("admin")
public class CommentController {
    @Autowired
    GoodsService goodsService;

    @GetMapping("comment/list")
    public BaseRespVo commetList(int page, int limit, String sort, String order,int userId,int valueId) {
        GoodsCommetVO goodsCommetVO;
        goodsCommetVO = goodsService.CommentList(page, limit, sort, order,userId,valueId);
        return BaseRespVo.ok(goodsCommetVO);
    }

    @PostMapping("comment/delete")
    public BaseRespVo deleteCommentById(@RequestBody GoodsCommentDelete goodsCommentDelete) {
        int id = goodsCommentDelete.getId();
        goodsService.deleteGoodsCommentById(id);
        return BaseRespVo.ok();
    }
}
